<div class="row m-n">
    <div tabset type="tab">
        <div tab heading="业务伙伴管理" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <!-- <button class="btn btn-operate m-r-sm" ng-click="addData()" ng-disabled="!btnPermission.clientAdd"
                        title="{{!btnPermission.clientAdd?'无权限执行此操作':''}}">新增</button> -->
                    <button class="btn btn-operate m-r-sm" ng-click="bind()" ng-disabled="!btnPermission.clientBound"
                        title="{{!btnPermission.clientBound?'无权限执行此操作':''}}">绑定</button>
                    <!-- <button class="btn btn-operate m-r-sm" ng-click="importDealer()" ng-disabled="!btnPermission.clientImport"
                        title="{{!btnPermission.clientImport?'无权限执行此操作':''}}">导入业务伙伴</button> -->
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                    </div>
                    <button class="btn-advance pull-right m-l-xs"
                        ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="业务伙伴名称"
                            ng-model="condition.companyName">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">业务伙伴名称：</label>
                        <input type="text" name="dealerCode" ng-model="condition.companyName" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">业务伙伴编号：</label>
                        <input type="text" name="dealerCode" ng-model="condition.dealerCode" class="form-control">
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tbConf" col-fixed="true"
                has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                    </th>
                                    <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConf.fixedWidth"
                                            fixed-width="tbStyle.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConf.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0" >
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item)"></div>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="font-0">
                                            <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.clientEdit"
                                                title="{{!btnPermission.clientEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="delData('single', item.id)"
                                                ng-disabled="!btnPermission.clientDel"
                                                title="{{!btnPermission.clientDel?'无权限执行此操作':''}}">删除</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="invite(item.id)"
                                                ng-disabled="item.isPlatCompany||item.applyStatus == 3 || !btnPermission.clientInvite"
                                                title="{{!btnPermission.clientInvite?'无权限执行此操作':''}}">邀请</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="restPwd(item.platOrgId)"
                                                ng-disabled="!btnPermission.clientRestPwd"
                                                title="{{!btnPermission.clientRestPwd?'无权限执行此操作':''}}">重置密码</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="clickUp(item.id)"
                                                ng-disabled="!btnPermission.clientUp || item.stopFlag == 0"
                                                title="{{!btnPermission.clientUp?'无权限执行此操作':''}}">启用</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="clickStop(item.id)"
                                                ng-disabled="!btnPermission.clientStop || item.stopFlag == 1"
                                                title="{{!btnPermission.clientStop?'无权限执行此操作':''}}">停用</button>        
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span ng-if="!itemCol.clickFn">{{item[itemCol.dataField]}}</span>
                                        <a ng-if="!!itemCol.clickFn" class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-check-box class="m-t-xs m-r-sm" yb-checked="markInfo.allChecked" yb-check-name="全选"
                    yb-click="selectAll()"></div>
                <button class="btn btn-operate" ng-click="delData('batch')" ng-disabled="!btnPermission.clientDel"
                    title="{{!btnPermission.clientDel?'无权限执行此操作':''}}">删除</button>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <form name="form" class="form-horizontal wrapper-md clearfix" novalidate>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i>*</i>业务伙伴类别：</label>
                    <div class="col-xs-5 wrapper-none">
                        <select name="dealerType" class="form-control" ng-model="detailInfo.dealerType" required ng-change="handleCompanyTypeChange()">
                            <option value="">请选择</option>
                            <option value="2">代理商</option>
                            <option value="5">服务站</option>
                            <option value="20" ng-if="curOrg.companyType==2">自建二级代理商</option>
                            <option value="50" ng-if="curOrg.companyType==5">自建二级服务站</option>
                        </select>
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.dealerType.$dirty || (form.dealerType.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.dealerType.$error.required && !form.dealerType.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-2 control-label"><i>*</i>业务伙伴编号：</label>
                    <div class="col-xs-5 wrapper-none">
                        <div name="dealerCode" yb-form-clear
                            ng-if="detailInfo.dealerType!=20&&detailInfo.dealerType!=50"
                            ng-model="detailInfo.dealerCode"
                            title="detailInfo.dealerCode"
                            select-obj="selectDealer()"
                            clear-form="clearDealer()"
                            tips-name="业务伙伴"
                            form-require="curOrg.companyType==1"></div>

                        <input type="text" name="dealerCode" class="form-control"
                            ng-if="detailInfo.dealerType==20||detailInfo.dealerType==50"
                            ng-model="detailInfo.dealerCode"
                            required yb-focus maxlength="20">
                    </div>

                    <div class="col-xs-4 msg-block" ng-if="!detailInfo.dealerCode && submitted">
                        <div class="error-msg">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-2 control-label"><i>*</i>业务伙伴名称：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="companyName" class="form-control" ng-model="detailInfo.companyName"
                            required yb-focus maxlength="50">
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.companyName.$dirty || (form.companyName.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.companyName.$error.required && !form.companyName.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label">业务伙伴简称：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="shortName" class="form-control" ng-model="detailInfo.shortName"
                            maxlength="20">
                    </div>
                </div>

                <div class="form-group m-b-sm" ng-if="curOrg.companyType==1">
                    <label class="col-xs-2 control-label"><i ng-if="detailInfo.dealerType==2">*</i>所属营销中心(道路)：</label>
                    <div class="col-xs-5 wrapper-none">
                        <label class="control-label" ng-if="!detailInfo.dealerType">-</label>
                        
                        <input type="text" readonly="readonly" class="form-control" name="marketingCenterName"
                            ng-model="detailInfo.marketingCenterName" ng-if="detailInfo.dealerType==5">
                        
                        <div yb-form-clear name="marketingCenterName" ng-model="detailInfo.marketingCenterName"
                            select-obj="selectMarketingCenter('DL')" ng-if="detailInfo.dealerType==2"
                            clear-form="clearMarketingCenter('DL')" tips-name="营销中心(道路)" required></div>
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.marketingCenterName.$dirty || (form.marketingCenterName.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.marketingCenterName.$error.required && !form.marketingCenterName.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group m-b-sm" ng-if="curOrg.companyType==1">
                    <label class="col-xs-2 control-label"><i ng-if="detailInfo.dealerType==2">*</i>所属营销中心(非道路)：</label>
                    <div class="col-xs-5 wrapper-none">
                        <label class="control-label" ng-if="!detailInfo.dealerType">-</label>

                        <input type="text" readonly="readonly" class="form-control" name="marketingCenterName2"
                            ng-model="detailInfo.marketingCenterName2" ng-if="detailInfo.dealerType==5">
                        
                        <div yb-form-clear name="marketingCenterName2" ng-model="detailInfo.marketingCenterName2"
                            select-obj="selectMarketingCenter('FDL')" ng-if="detailInfo.dealerType==2"
                            clear-form="clearMarketingCenter('FDL')" tips-name="营销中心(非道路)" required></div>
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.marketingCenterName2.$dirty || (form.marketingCenterName2.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.marketingCenterName2.$error.required && !form.marketingCenterName2.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-2 control-label"><i ng-if="detailInfo.dealerType&&detailInfo.dealerType!=5">*</i>地址：</label>
                    <div class="col-xs-5 wrapper-none">
                        <label class="control-label" ng-if="!detailInfo.dealerType">-</label>
                        
                        <input type="text" class="form-control" ng-model="detailInfo.address" ng-if="detailInfo.dealerType==5"
                            maxlength="64" disabled>

                        <div yb-form-clear name="address" ng-model="detailInfo.address" select-obj="selectAddress()" ng-if="detailInfo.dealerType&&detailInfo.dealerType!=5"
                            clear-form="clearAddress()" tips-name="地址" required></div>
                    </div>
                    <div class="col-xs-4 msg-block" ng-show="form.address.$dirty || (form.address.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.address.$error.required">
                            <i class="yb-icon ico-times-circular"></i><span>必填项，请填写</span>
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-if="tabFlag.type==1&&(detailInfo.dealerType==5||detailInfo.dealerType==50)">
                    <label class="col-xs-2 control-label">坐标：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" class="form-control" ng-model="detailInfo.zb" disabled>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label">联系人：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="contact" class="form-control" ng-model="detailInfo.contact"
                            maxlength="40">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label">联系方式：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="contactTel" class="form-control" ng-model="detailInfo.contactTel"
                            yb-contact yb-focus>
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.contactTel.$dirty || (form.contactTel.$invalid&&submitted)">
                        <div class="error-msg" ng-show="form.contactTel.$error.contactInfo && !form.contactTel.focused">
                            <i class="yb-icon ico-times-circular"></i>请输入正确的手机号码或电话号码
                        </div>
                    </div>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">邮编：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="zip" class="form-control" ng-model="detailInfo.zip" maxlength="15">
                    </div>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">价格组：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" readonly="readonly" name="priceGroup" class="form-control"
                            ng-model="detailInfo.priceGroup" maxlength="15">
                    </div>
                </div>
                <div class="form-group m-b-sm" ng-if="(detailInfo.dealerType==20 ||detailInfo.dealerType==2) && curOrg.companyType == 1">
                    <label class="col-xs-2 control-label">是否允许服务站订货：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.isAllowFwzOrder" value="1"
                            yb-radio-name="是">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.isAllowFwzOrder" value="0"
                            yb-radio-name="否">
                    </label>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">是否查看库存：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.isStorage" value="1"
                            yb-radio-name="是">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.isStorage" value="0"
                            yb-radio-name="否">
                    </label>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">业务伙伴状态：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.normalFlag" value="1"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="正常维护">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.normalFlag" value="2"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="已流失">
                    </label>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">是否限制最小采购：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.noLimitMinFlag" value="0"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="限制">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.noLimitMinFlag" value="1"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="不限制 ">
                    </label>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">启停状态：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.stopFlag" value="0"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="启用">
                        <input type="radio" class="m-r-sm pull-left" yb-radio ng-model="detailInfo.stopFlag" value="1"
                            yb-disabled="tabFlag.type==1&&!!detailInfo.normalFlagOld" yb-radio-name="停用">
                    </label>
                </div>
                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">直投达标金额：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="directLimit" class="form-control" ng-model="detailInfo.directLimit"
                            yb-number-input disable-decimal="false" decimal-places="2" max="9999999.99">
                    </div>
                </div>
                <div class="form-group m-b-sm" ng-if="detailInfo.id">
                    <label class="col-xs-2 control-label">授信额度：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="creditAmount" class="form-control" ng-model="detailInfo.creditAmount" maxlength="15">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-xs-offset-2">
                        <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)">保存</button>
                        <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
                    </div>
                </div>
            </form>
        </div>
        <div tab heading="绑定" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="main-area d-t-35 d-b-60">
                <form name="boundForm" class="main-wrap form-horizontal single-col p-t-md clearfix" novalidate>
                    <div class="form-group border-b p-b-md">
                        <label class="col-xs-2 control-label"><i>*</i>邀请码：</label>
                        <div class="col-xs-4 wrapper-none">
                            <input type="text" name="invitationCode" class="form-control"
                                ng-model="boundObj.invitationCode" required yb-focus>
                        </div>
                        <div class="col-xs-1 wrapper-none p-l-sm">
                            <button class="btn btn-primary w-full" ng-click="getInfo(boundForm.$valid)">查询</button>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="boundForm.invitationCode.$dirty || (boundForm.invitationCode.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="boundForm.invitationCode.$error.required && !boundForm.invitationCode.focused">
                                <i class="yb-icon ico-times-circular"></i>请输入合法的邀请码
                            </div>
                        </div>
                    </div>
                    <div ng-if="!!orgInfo.orgId">
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">组织机构代码：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.orgCode}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">企业名称：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.companyName}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">企业简称：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.shortName}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">渠道：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.channelDesc}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">地址：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.address||'-'}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">联系人：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.contact||'-'}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">联系电话：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.contactTel||'-'}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">传真：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.fax||'-'}}
                            </label>
                        </div>
                        <div class="form-group m-b-none">
                            <label class="col-xs-2 control-label">创建日期：</label>
                            <label class="col-xs-8 control-label text-left spill-dots">
                                {{orgInfo.createDate|YbDate}}
                            </label>
                        </div>
                    </div>
                </form>
            </div>
            <div class="bottom-area btn-bar single-col border-t clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-disabled="!orgInfo.orgId"
                    ng-click="doBind(boundForm.$valid)">绑定</button>
                <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
            </div>
        </div>
    </div>
</div>